package fhjoanneum.itm11.antesk.simplehack;

public class PlayerCharacter extends Character
{
	// Members -----------------------------------------------------------
	private Inventory inventory;
	
	// Constructors ------------------------------------------------------
	PlayerCharacter(){}
	PlayerCharacter(Tile position)
	{
		setHitpoints(100);
		setAtk(1);
		setName("Hero");
		setAc(0.5);
		setHitChance(1);
		setPosition(position);
		setTest("P");
		setLevel(1);
		setExp(0);
		inventory = new Inventory();
	}
	
	// Methods ===========================================================
	
	// Getters and setters -----------------------------------------------
	public Inventory getInventory(){return this.inventory;}
	public Level getLevelClass(){return level_class;}
	public void setLevelClass(Level level_class){
		this.level_class = level_class;}

	// Enum return type---------------------------------------------------
	public CharacterType getType()
	{
		return CharacterType.PLAYER;
	}
	
	// Use method --------------------------------------------------------
	public void use(int index)
	{
		if(index <= -1)
		{
			System.out.println("Invalid item slot number.");
		}
		else if(inventory.getInventory().size() < index || 
				inventory.getInventory().size() == 0)
		{
			System.out.println("No item at position " + index);
		}
		else
		{
			inventory.getInventory().elementAt(index).use(this);
			inventory.getInventory().remove(index);
		}
	}

}
